#include <bits/stdc++.h>
using namespace std;

const int maxn = 1e5+10;
typedef long long ll;

ll n;
ll r[maxn],p[maxn],cnt,num[maxn],sum;

int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    ios::sync_with_stdio(0);
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>r[i];
    sort(r+1,r+1+n);
    for(int i=1;i<=n;i++){
        num[r[i]]++;
        if(num[r[i]] == 1)
            p[++cnt]++;
        else
            p[cnt]++;
    }
    for(int i=1;i<=n;i++){
        int a = 0;
        for(int j=1;j<=cnt;j++){
            if(p[j] == 0)
                continue;
            p[j]--;
            a++;
        }
        if(a > 0)
            sum++;
        else
            break;
    }
    cout<<sum;
    return 0;
}
